package com.dog.basics.rabbitmq.callback;

import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

/**
 * @program: d-basic-composition
 *
 * @description: 生产者 - 生产者消息确认编写
 *
 * @author: Guo
 *
 * @create: 2019-08-10 11:48
 **/
@Log4j2
public class RabbitConfirmCallback implements RabbitTemplate.ConfirmCallback {

	@Override
	public void confirm(CorrelationData correlationData, boolean ack, String cause) {
		if (ack) {
			log.info("消息发送成功:correlationData({}),ack({}),cause({})", correlationData, ack, cause);
		}else {
			log.info("消息可能未到达rabbitmq服务器:correlationData({}),ack({}),cause({})", correlationData, ack, cause);
		}
	}
}
